﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Domain;
using Persistence;
using Persistence.Dao;
using Common;
namespace web.member
{
    public partial class myOrderDetail : memberBase
    {
        int id = DNTRequest.GetQueryInt("id", 0);
        protected Order entity_Order = new Order();

        protected IList<OrderDetailMen> menlist = new List<OrderDetailMen>();
        protected IList<OrderDetailKou> koulist = new List<OrderDetailKou>();
        protected IList<OrderDetailOther> otherlist = new List<OrderDetailOther>();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (id > 0)
                {
                    entity_Order = Singleton<OrderDao>.Instance.GetModel(id);
                    BindList();
                }
            }
        }
        private void BindList()
        {
            menlist = Singleton<OrderDetailMenDao>.Instance.GetModels("*", "orderid = " + id);
            koulist = Singleton<OrderDetailKouDao>.Instance.GetModels("*", "orderid = " + id);
            otherlist = Singleton<OrderDetailOtherDao>.Instance.GetModels("*", "orderid = " + id);
            if (menlist.Count > 0)
            {
                rptList.Visible = true;
                rptList.DataSource = menlist;
                rptList.DataBind();
            }
            else
            {
                rptList.Visible = false;
            }
            if (koulist.Count > 0)
            {
                Repeater1.Visible = true;
                Repeater1.DataSource = koulist;
                Repeater1.DataBind();
            }
            else
            {
                Repeater1.Visible = false;
            }
            if (otherlist.Count > 0)
            {
                Repeater2.Visible = true;
                Repeater2.DataSource = otherlist;
                Repeater2.DataBind();
            }
            else
            {
                Repeater2.Visible = false;
            }
        }
    }
}
